package ToStringPractise;

public class Circle extends GeometricObject{
    private Double radius;

    public Circle() {
        color="white";
        weight=1.0;
        radius=1.0;
    }

    public Circle(Double radius) {
        weight=1.0;
        color="white";
        this.radius = radius;
    }

    public Circle(String color, Double weight, Double radius) {
        super(color, weight);
        this.radius = radius;
    }

    public Double getRadius() {
        return radius;
    }

    public void setRadius(Double radius) {
        this.radius = radius;
    }
    public Double findArea(){
        return 3.14*radius*radius;
    }
    //重写equals

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if(o instanceof Circle){
            Circle c=(Circle) o;
            return this.radius==c.radius;
        }
        return false;
    }

    @Override
    public String toString() {
        return "Circle{" +
                "radius=" + radius +
                '}';
    }
}
